<template>
  <m-page>
    <!-- 长湘贷额度页（【长湘贷循环】未借款） -->
    <m-header title="长湘贷"></m-header>
    <p class="credit1">可用额度（元）</p>
    <p class="number1" @click="handleLimit">80,000.00</p>
    <p class="credit2">总额度（元）</p>
    <p class="number2">80,000.00</p>
    <div class="go-borrow" @click="handleLoans">去借款</div>
    <div class="current">
      <span class="left" @click="handleHold">当前持有</span>
      <span class="right">共0笔</span>
    </div>

    <div @click="handleHold">当前持有</div>
    <div @click="handleReturn">最近应还</div>
  </m-page>
</template>

<script>
  export default {
    components: {},
    data() {
      return {

      }
    },
    methods: {
      // 跳转到借还记录
      handleHistory() {
        // 跳转到借还记录
        let params = {}
        app.api.pushWindow(
          "long_xiang_loans/borrowed_record.html",
          params
        )
      },
      handleLoans() {
        let flag = false
        if (flag) {
          // 如果没有结清贷款
          this.uncleared();
          return
        }

        // 跳转到借款申请页
        let params = {}
        app.api.pushWindow(
          "long_xiang_loans/loans_borrow_apply.html",
          params
        )
      },
      // 未结清付款
      uncleared() {
        let msg = '您有到期未结清付款，请先结清欠款，再来申请借款'
        // 是否加挂一类户
        app.api.confirm(msg, '提示', { okButton: '去还款', cancelButton: '取消' }).then(res => {
            if (res.ok) {
              // 调用后端接口提交签约

              // 跳转到签约结果页面
              let params = {}
              app.api.pushWindow(
                "long_xiang_loans/signed_result.html",
                params
              )
            } else {
              // 留在当前页面
            }
        });
      },
      handleLimit() {
        // 跳转到额度详情页
        let params = {}
        app.api.pushWindow(
          "long_xiang_loans/loans_amount_details.html",
          params
        )
      },
      handleHold() {
        // 跳转到当前持有页
        let params = {}
        app.api.pushWindow(
          "long_xiang_loans/myborrow_current_hold.html",
          params
        )
      },
      handleReturn() {
        // 跳转到最近应还页
        let params = {}
        app.api.pushWindow(
          "long_xiang_loans/myborrow_should_repay.html",
          params
        )
      }
    },
    created() {},
    mounted() {},
    watch: {},
    computed: {}
  }
</script>

<style lang="scss" scoped>
  @import './index.scss';
</style>

